import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
//引入axios
import axios from 'axios'
//引入vue封装axios
import VueAxios from 'vue-axios'
//引入vant的组件和对应的样式
import Vant from 'vant'
import 'vant/lib/index.css'
import BaiduMap from 'vue-baidu-map'

Vue.use(BaiduMap, {
  ak: 'jp4zxA4bBzxrWSzGrEQiuVGYP2X9vzuU'
})
//使用
Vue.use(VueAxios, axios)
axios.defaults.baseURL = 'http://localhost:8081'
// 请求拦截 实现请求自动携带令牌
axios.interceptors.request.use((config) => {
  // 将token设置到请求头中 config.headers.后台规定的用来提供token令牌的字段(一般api文档中会声明)=token
  config.headers.javatoken = store.state.token
  return config;
})
//设置使用Vant组件
Vue.use(Vant);

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
